import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path'; 

/**
 * Resolves the given directory path to an absolute path.
 * @param dir - The directory path to resolve
 * @returns The resolved absolute path as a string
 */
function resolve(dir: string) {
  return path.join(__dirname, '.', dir);
}

/**
 * Vite configuration export
 * - Registers React plugin
 * - Sets up path alias '@' to point to 'src' directory
 */
export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      '@': resolve('src'),
    },
  },
});